/*
 * 编写一个菜单区中程序的雏形.
 * 该程序显示一个提供四个选项的菜单__每个选项用一个字母标记.
 * 如果用户使用有效选项之外的字母进行响应,程序将提示用户输入一个有效的字母,知道用户这样做为止.
 * 然后,该程序使用一条switch语句,根据用户的选择执行一个简单操作.
*/
#include<iostream>

int main()
{
    std::cout <<
        "Please enter one of the following choice:\n"<<
        "c) carnivore \t\t\t\tp) pianist\n"<<
        "t) tree \t\t\t\tg) game\n"<<std::endl;
    char choice;
    std::cin >> choice;
    while(choice!='c'&&choice!='p'&&choice!='t'&&choice!='g')
    {
        std::cout<<"Please enter a c,p,t,g: ";
        std::cin>>choice;
    }
    switch(choice)
    {
        case 'c':
            std::cout<<"A sample is a carnivore.\n";
            break;
        case 'p':
            std::cout<<"A sample is a pianist.\n";
            break;
        case 't':
            std::cout<<"A sample is a tree.\n";
            break;
        case 'g':
            std::cout<<"A sample is a game.\n";
            break;
        default:
            break;
        }
    return 0;
}
